<?php
require_once '../vendor/autoload.php';
use PhpAmqpLib\Connection\AMQPStreamConnection;
use PhpAmqpLib\Message\AMQPMessage;

include_once("./Db_pdo.class.php");
ini_set('date.timezone','Asia/Shanghai');
$DB=new Db_pdo("test","root","root");
set_time_limit(0);




echo '<pre>';
$connection = new AMQPStreamConnection('localhost', 5672, 'guest', 'guest');
$channel = $connection->channel();
$channel->exchange_declare('logs','fanout',false,false,false);

$data = unserialize(file_get_contents('1.txt')); 

//print_r($data);
foreach ($data as $key => $value) {
		$arr['id'] = $value['0'];
		//$arr['name'] = $value['1'];
		//$date = json_encode($arr,JSON_UNESCAPED_UNICODE);
		$date = json_encode($arr);
		$msg = new AMQPMessage($date);
		$channel->basic_publish($msg,'logs');
}







$channel->close();
$connection->close();
 




// foreach ($data as $key => $value) {
		
// }
